let uuid = 1, _uuid
let unique = () => {
    uuid += 1
    return uuid
}
// 加载页面组件上加个装饰器，加载前加loading，加载完成后取消loading
let decorator = (cb) => {
    return (resolve) => {
        var div = document.createElement("div");
        div.setAttribute('id', 'topAlert')
        var divs = document.createElement("div");
        divs.setAttribute('class', 'Toast')
        var img = document.createElement("img");
        img.setAttribute('src', require('../assets/img/logn/loading@3x.gif'))
        var p = document.createElement("p");
        var oText = document.createTextNode("正在加载中");
        divs.appendChild(img);
        p.appendChild(oText);
        divs.appendChild(p);
        div.appendChild(divs);
        document.body.appendChild(div);
        _uuid = unique()
        let current_component = unique()
        let hideLoadingResolve = (fetched_component) => {
            return (component) => {
                if (current_component == fetched_component) {
                    if (document.getElementById("topAlert")) {
                        document.body.removeChild(document.getElementById("topAlert"));
                    }
                    return resolve(component)
                }
            }
        }
        cb(hideLoadingResolve(current_component))
    }
}
export default [

    {
        path: '/',
        name: 'Home',
        component: decorator((resolve) => {
            require(['../view/HomeVip/index'], resolve)
        })
    },
    {
        path: '/BuyVip',
        name: 'BuyVip',
        component: decorator((resolve) => {
            require(['../view/BuyVip/index'], resolve)
        })
    },
    // 原打卡页
    {
        path: '/BookShelf',
        name: 'BookShelf',
        component: (resolve) => {
            require(['../view/BookShelf/index'], resolve)
        }
    },
    // 卡片页
    {
        path: '/BookShelfNew',
        name: 'BookShelfNew',
        component: (resolve) => {
            require(['../view/BookShelfNew/index'], resolve)
        }
    },
    // 软文页
    {
        path: '/BookShelfAdvertorial',
        name: 'BookShelfAdvertorial',
        component: (resolve) => {
            require(['../view/BookShelfAdvertorial/index'], resolve)
        }
    },
    {
        path: '/AllBooks',
        name: 'AllBooks',
        component: decorator((resolve) => {
            require(['../view/AllBooks/index'], resolve)
        })
    },
    {
        path: '/Collection',
        name: 'Collection',
        component: decorator((resolve) => {
            require(['../view/Collection/index'], resolve)
        })
    },
    {
        path: '/Chapter',
        name: 'Chapter',
        component: decorator((resolve) => {
            require(['../view/Chapter/index'], resolve)
        })
    },
    {
        path: '/Playing',
        name: 'Playing',
        component: decorator((resolve) => {
            require(['../view/Playing/index'], resolve)
        })
    },
    {
        path: '/Answer',
        name: 'Answer',
        component: decorator((resolve) => {
            require(['../view/Answer/index'], resolve)
        })
    },
    {
        path: '/Handouts',
        name: 'Handouts',
        component: decorator((resolve) => {
            require(['../view/Handouts/index'], resolve)
        })
    },
    {
        path: '/wallet',
        name: 'wallet',
        component: decorator((resolve) => {
            require(['../view/NewWallet/index'], resolve)
        })
    },
    {
        path: '/VipCard',
        name: 'VipCard',
        component: decorator((resolve) => {
            require(['../view/NewVipCard/index'], resolve)
        })
    },
    {
        path: '/Details',
        name: 'Details',
        component: decorator((resolve) => {
            require(['../view/OrderDetails/index'], resolve)
        })
    },
    {
        path: '/PayResults',
        name: 'PayResults',
        component: decorator((resolve) => {
            require(['../view/PayResults/index'], resolve)
        })
    },
    {
        path: '/testing',
        name: 'testing',
        component: decorator((resolve) => {
            require(['../view/testing/index'], resolve)
        })
    },
    {
        path: '/Questions',
        name: 'Questions',
        component: decorator((resolve) => {
            require(['../view/Questions/index'], resolve)
        })
    },
    {
        path: '/TestResult',
        name: 'TestResult',
        component: decorator((resolve) => {
            require(['../view/TestResult/index'], resolve)
        })
    },
    {
        path: '/Binding',
        name: 'Binding',
        component: decorator((resolve) => {
            require(['../view/Binding/index'], resolve)
        })
    },
    {
        path: '/Area',
        name: 'Area',
        component: decorator((resolve) => {
            require(['../view/Area/index'], resolve)
        })
    },
    {
        path: '/Address',
        name: 'Address',
        component: decorator((resolve) => {
            require(['../view/Address/index'], resolve)
        })
    },
    {
        path: '/Promotion',
        name: 'Promotion',
        component: decorator((resolve) => {
            require(['../view/Promotion/index'], resolve)
        })
    },
    {
        path: '/PromCard',
        name: 'PromCard',
        component: decorator((resolve) => {
            require(['../view/PromCard/index'], resolve)
        })
    },
    {
        path: '/Reflect',
        name: 'Reflect',
        component: decorator((resolve) => {
            require(['../view/Reflect/index'], resolve)
        })
    },
    {
        path: '/Detailed',
        name: 'Detailed',
        component: decorator((resolve) => {
            require(['../view/Detailed/index'], resolve)
        })
    },
    {
        path: '/CashDetailed',
        name: 'CashDetailed',
        component: decorator((resolve) => {
            require(['../view/CashDetailed/index'], resolve)
        })
    },
    {
        path: '/Remind',
        name: 'Remind',
        component: decorator((resolve) => {
            require(['../view/Remind/index'], resolve)
        })
    },
    {
        path: '/BookCard',
        name: 'BookCard',
        component: decorator((resolve) => {
            require(['../view/BookCard/index'], resolve)
        })
    },
    {
        path: '/PatchDetails',
        name: 'PatchDetails',
        component: decorator((resolve) => {
            require(['../view/PatchDetails/index'], resolve)
        })
    },
    {
        path: '/TestInfo',
        name: 'TestInfo',
        component: decorator((resolve) => {
            require(['../view/TestInfo/index'], resolve)
        })
    },
    {
        path: '/SunCard',
        name: 'SunCard',
        component: decorator((resolve) => {
            require(['../view/SunCard/index'], resolve)
        })
    },
    {
        path: '/Users',
        name: 'Users',
        component: decorator((resolve) => {
            require(['../view/Users/index'], resolve)
        })
    },
    // 申请奖学金
    {
        path: '/Reward',
        name: 'Reward',
        component: decorator((resolve) => {
            require(['../view/reward/index'], resolve)
        })
    },
    // 奖学金地址
    {
        path: '/UploadPic',
        name: 'UploadPic',
        component: decorator((resolve) => {
            require(['../view/uploadPic/index'], resolve)
        })
    },
    // 奖学金申请成功
    {
        path: '/RewardSuccess',
        name: 'RewardSuccess',
        component: decorator((resolve) => {
            require(['../view/rewardSuccess/index'], resolve)
        })
    },
    //奖学金填写地址
    {
        path: '/RewardAddress',
        name: 'RewardAddress',
        component: decorator((resolve) => {
            require(['../view/RewardAddress/index'], resolve)
        })
    },
    {
        path: '/Voucher',
        name: 'Voucher',
        component: decorator((resolve) => {
            require(['../view/Voucher/index'], resolve)
        })
    },
    // 书籍分类
    {
        path: '/BookTypes',
        name: 'BookTypes',
        component: (resolve) => {
            require(['../view/bookTypes/index'], resolve)
        }
    },
    // 错误页面
    {
        path: '/Error',
        name: 'Error',
        component: (resolve) => {
            require(['../view/Error/index'], resolve)
        }
    },
    // 书单详情
    {
        path: '/BookOrders',
        name: 'BookOrders',
        component: (resolve) => {
            require(['../view/BookOrders/index'], resolve)
        }
    },
    {
        path: '/Recommend',
        name: 'Recommend',
        component: (resolve) => {
            require(['../view/Recommend/index'], resolve)
        }
    },
    // 视频分享页面
    {
        path: '/BookShelfVideo',
        name: 'BookShelfVideo',
        component: (resolve) => {
            require(['../view/BookShelfVideo/index'], resolve)
        }
    },
    //试听
    {
        path: '/freeListenChapter',
        name: 'freeListenChapter',
        component: (resolve) => {
            require(['../view/freeListenChapter/index'], resolve)
        }
    },// 共读活动
    {
        path: '/ComreadAction',
        name: 'ComreadAction',
        component: (resolve) => {
            require(['../view/ComreadAction/index'], resolve)
        }
    },
    // 购买邀请码
    {
        path: '/ComreadInvitecodeBuy',
        name: 'ComreadInvitecodeBuy',
        component: (resolve) => {
            require(['../view/ComreadInvitecodeBuy/index'], resolve)
        }
    },
    // 购买邀请码支付成功
    {
        path: '/ComreadBuysucess',
        name: 'ComreadBuysucess',
        component: (resolve) => {
            require(['../view/ComreadBuysucess/index'], resolve)
        }
    },
    // 激活邀请码
    {
        path: '/ComreadActivate',
        name: 'ComreadActivate',
        component: (resolve) => {
            require(['../view/ComreadActivate/index'], resolve)
        }
    },
    // 购买邀请码详情页（下面购买按钮）
    {
        path: '/ComreadBuyinfo',
        name: 'ComreadBuyinfo',
        component: (resolve) => {
            require(['../view/ComreadBuyinfo/index'], resolve)
        }
    },
    // 新推荐购买页
    {
        path: '/NewPromotion',
        name: 'NewPromotion',
        component: (resolve) => {
            require(['../view/NewPromotion/index'], resolve)
        }
    }
]
